package com.epfresh.supplier.entity;

import com.google.gson.Gson;

/**
 * Created by wzh on 2016/4/14.
 */
public class LocalUploadFileEntity {

    private int id = Integer.MIN_VALUE;
    private long modified;
    private long totalSpace;

    public LocalUploadFileEntity() {

    }

    public static LocalUploadFileEntity getLocalUploadFileEntity(String gosnString) {
        return new Gson().fromJson(gosnString, LocalUploadFileEntity.class);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public long getModified() {
        return modified;
    }

    public void setModified(long modified) {
        this.modified = modified;
    }

    public long getTotalSpace() {
        return totalSpace;
    }

    public void setTotalSpace(long totalSpace) {
        this.totalSpace = totalSpace;
    }

    public boolean isUpload(long modified, long totalSpace) {
        return this.id > 0 && this.modified > 0 && this.modified == modified && this.totalSpace > 0 && this.totalSpace == totalSpace;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
